// DMPluginWrapper.h

#pragma once

#include "dmalgointerfaces.h"


using namespace System;
using namespace System::Reflection;
using namespace System::Runtime::InteropServices;

#include "DMEnumerationWrappers.h"
#include "DMMiningParameter.h"
#include "DMCaseIterHelper.h"
#include "DMAttributeSet.h"

namespace Microsoft
{
namespace SqlServer
{
namespace DataMining
{
namespace PluginAlgorithms
{

	const System::UInt32 PersistItemTagBase = DMPI_ALGORITHMSPECIFIC_BASE;
// Engine-to-Plugin
#define E2PTag(x)	(PersistItemTag)(x - PersistItemTagBase)
// Plugin-to-Engine
#define P2ETag(x)	(DM_PERSIST_ITEM)(x + PersistItemTagBase)


	///////////////////////////////////////////////////////////
	// PersistenceReader -- wraps an IDMPersistenceReader
	public enum PersistItemTag
	{
		Base	=	0,
	};

	


	public   ref class PersistenceReader sealed 
	{
		IDMPersistenceReader*	m_wpRdr;

	internal:
		PersistenceReader(IDMPersistenceReader*	in_pRdr)
		{
			m_wpRdr	=	in_pRdr;
		}
	
	public:
		
	
		property System::UInt32	Version
		{
			System::UInt32	get();
		}
		

		property PersistItemTag	Tag
		{
			PersistItemTag	get();
		}
		
		void			ReadCollection([Out]  System::UInt32* count	);
		void			ReadScope();
		void			CloseScope();

		void			OpenScope(PersistItemTag tag);
		void			StartCollection(PersistItemTag tag, [Out]System::UInt32^% count);
		void			EndCollection();

		void			GetValue( [Out]System::Boolean% value);
		void			GetValue( [Out]System::Double%  value);
		void			GetValue( [Out]System::Int16%  value);
		void			GetValue( [Out]System::Int32%  value);
		void			GetValue( [Out]System::UInt32%  value);
		void			GetValue( [Out]System::String^%   value);
		//void			GetValue( [Out]System::Object __gc **  val);
		void			GetValue( [Out]System::DateTime%  value);

		void			GetAttribute( PersistItemTag tag, [Out]System::Boolean% value);
		void			GetAttribute( PersistItemTag tag, [Out]System::Double%  value);
		void			GetAttribute( PersistItemTag tag, [Out]System::Int16%  value);
		void			GetAttribute( PersistItemTag tag, [Out]System::Int32%  value);
		void			GetAttribute( PersistItemTag tag, [Out]System::UInt32%  value);
		void			GetAttribute( PersistItemTag tag, [Out]System::String^%   value);
		//void			GetAttribute( PersistItemTag tag, [Out]System::Object __gc **  value);
		void			GetAttribute( PersistItemTag tag, [Out]System::DateTime%  value);
	};


	public   ref class PersistenceWriter sealed 
	{
		IDMPersistenceWriter*	m_wpWriter;

	internal:
		PersistenceWriter(IDMPersistenceWriter*	in_pWriter)
		{
			m_wpWriter	=	in_pWriter;
		}
	
	public:

		void			OpenScope(PersistItemTag tag);
		void			CloseScope();


		void			StartCollection(PersistItemTag tag, System::UInt32 count);
		void			EndCollection();

		void			SetValue( System::Boolean value);
		void			SetValue( System::Double  value);
		void			SetValue( System::Int16  value);
		void			SetValue( System::Int32  value);
		void			SetValue( System::UInt32  value);
		void			SetValue( System::String  ^  value);
		//void			SetValue( System::Object __gc *  value);
		void			SetValue( System::DateTime  value);

		void			SetAttribute( PersistItemTag tag, System::Boolean value);
		void			SetAttribute( PersistItemTag tag, System::Double  value);
		void			SetAttribute( PersistItemTag tag, System::Int16  value);
		void			SetAttribute( PersistItemTag tag, System::Int32  value);
		void			SetAttribute( PersistItemTag tag, System::UInt32  value);
		void			SetAttribute( PersistItemTag tag, System::String  ^  value);
		//void			SetAttribute( PersistItemTag tag, System::Object __gc *  value);
		void			SetAttribute( PersistItemTag tag, System::DateTime   value);
	};
}
}
}
}
